var str = '123212gfg';
var number = parseInt(str, 10);
console.log(number);